/*
 * xAPHeartBeat.java
 *
 * Java class used to send xAP heart-beat messages
 *
 * Copyright (c) 2009 Daniel Berenguer <dberenguer@usapiens.com>
 *
 * This file is part of the jxAP project.
 *
 * OPNODE is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * OPNODE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with canTracer; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * 02/11/09 by Daniel Berenguer : first version
 */

package xAP;

/********************************************************************************************
 * xAPHeartBeat class
 *
 *********************************************************************************************/
public class xAPHeartBeat extends xAPBSCmessage
{
   /********************************************************************************************
    * Member variables
    ********************************************************************************************/

   /********************************************************************************************
    * xAPHeartBeat
    *
    * Class constructor
    *
    * 'alive'   if true, xap-hbeat.alive message
    *           if false, xap-hbeat.stop message
    ********************************************************************************************/
    public xAPHeartBeat(boolean alive)
    {
        version = drvCore.xAP_Version;

        if (alive)
            xClass = "xap-hbeat.alive";
        else
            xClass = "xap-hbeat.stopped";

        uid = drvCore.xAP_BaseUID + ":0000";
        source = drvCore.xAP_SourceAddr;

        message = "xap-hbeat\n{\nv=" + version + "\nhop=1\nuid=" + uid + "\nclass=" + xClass + "\nsource="
                + source + "\ninterval=60\nport=" + drvCore.xAP_Port + "\n}\n";
    }
}
